package com.lhkj.ct.meta.admin.model.vo;


import com.alibaba.fastjson2.JSONObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 菜单路由视图对象
 *
 * @author haoxr
 * @since 2020/11/28
 */
@ApiModel(description = "路由对象")
@Data
//@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class RouterVo {

    @ApiModelProperty(value = "路由路径", example = "user")
    private String path;

    @ApiModelProperty(value = "路由名称")
    private String name;

    @ApiModelProperty(value = "组件路径", example = "system/user/index")
    private String component;

    @ApiModelProperty("全路径")
    private String fullPath;

    @ApiModelProperty("路由组件name")
    private String componentName;

    @ApiModelProperty(value = "跳转链接", example = "https://www.youlai.tech")
    private String redirect;

    @ApiModelProperty(value = "路由属性")
    private JSONObject meta;

    public void builderMeta(String meta) {
        if (StringUtils.isBlank(meta)) {
            this.meta = new JSONObject();
            return;
        }
        this.meta = JSONObject.parseObject(meta);
    }

    @ApiModelProperty(value = "子路由列表")
    private List<RouterVo> children = new ArrayList<>();
}
